package isjinhao.jlox.grammar.code.represention;

import isjinhao.jlox.grammar.code.visitor.CodeVisitor;
import isjinhao.jlox.grammar.expression.represention.Expression;
import isjinhao.jlox.grammar.statement.represention.Statement;
import lombok.Getter;

/**
 * @Author ISJINHAO
 * @Date 2021/2/28 10:41
 */
@Getter
public class ForCode extends Code {

    private Statement preLoop;

    private Expression condition;

    private Statement postEachIteration;

    private Statement statement;

    @Override
    public <R> R accept(CodeVisitor<R> codeVisitor) {
        return codeVisitor.visitForCode(this);
    }

    public ForCode(Statement preLoop, Expression condition, Statement postEachIteration, Statement statement) {
        this.preLoop = preLoop;
        this.condition = condition;
        this.postEachIteration = postEachIteration;
        this.statement = statement;
    }

}
